package com.netease.pris.activity;

import android.net.Uri;
import android.os.Handler;
import android.text.TextUtils;
import com.netease.pris.atom.g;
import com.netease.pris.atom.u;
import com.netease.pris.v;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class ed
{
  static final int a = 0;
  static final int b = 1;
  private boolean c = false;
  private boolean d = false;
  private int e;
  private int f;
  private int g;
  private Handler h = new fd(this);
  private Handler i = null;
  private Object j = new Object();
  private List k = new ArrayList();
  private List l = new LinkedList();
  private HashMap m = new HashMap();

  private void c(int paramInt)
  {
    if (this.h != null)
      this.h.sendEmptyMessage(paramInt);
  }

  private boolean c()
  {
    if (this.k == null);
    while (true)
    {
      return false;
      if (this.k.isEmpty())
        continue;
      synchronized (this.j)
      {
        Uri localUri = (Uri)this.k.remove(0);
        StringBuilder localStringBuilder = new StringBuilder();
        com.netease.image.d.a().a(localStringBuilder, 2, localUri.toString(), new fc(this), this.f, this.g, 0, this.e);
      }
    }
  }

  private void d()
  {
    if ((e()) && (!this.d))
    {
      c(1);
      this.d = true;
    }
    while (true)
    {
      return;
      c();
    }
  }

  private boolean e()
  {
    while (true)
    {
      synchronized (this.j)
      {
        if ((this.k.size() <= 0) && (this.l.size() == 0))
        {
          n = 1;
          return n;
        }
      }
      int n = 0;
    }
  }

  public int a(com.netease.pris.protocol.d paramd, boolean paramBoolean)
  {
    this.c = paramBoolean;
    while (true)
    {
      synchronized (this.j)
      {
        this.k.clear();
        this.m.clear();
        if (paramd == null)
        {
          label34: int i1 = this.k.size();
          if (i1 <= 0)
            break label261;
          c(0);
          return i1;
        }
      }
      if (paramd.h == null)
        continue;
      this.d = false;
      Iterator localIterator = paramd.h.iterator();
      while (true)
      {
        if (!localIterator.hasNext())
          break label34;
        u localu = (u)localIterator.next();
        if (!localu.v())
          break;
        String str1 = localu.b(g.f);
        if (!TextUtils.isEmpty(str1));
        synchronized (this.j)
        {
          this.k.add(Uri.parse(str1));
          this.m.put(localu.V(), str1);
          String str2 = localu.b(g.b);
          if (TextUtils.isEmpty(str2))
            continue;
          synchronized (this.l)
          {
            int n = v.a().a(str2, localu);
            if (n > 0)
              this.l.add(new Integer(n));
          }
        }
      }
      label261: if (!this.c)
        continue;
      c(1);
    }
  }

  public void a()
  {
    if (this.k != null)
      this.k.clear();
    if (this.m != null)
      this.m.clear();
    if (this.h != null)
      this.h.removeCallbacksAndMessages(null);
  }

  public void a(int paramInt)
  {
    this.e = paramInt;
  }

  public void a(int paramInt1, int paramInt2)
  {
    this.f = paramInt1;
    this.g = paramInt2;
  }

  public void a(Handler paramHandler)
  {
    this.i = paramHandler;
  }

  public HashMap b()
  {
    return this.m;
  }

  public void b(int paramInt)
  {
    Integer localInteger = new Integer(paramInt);
    if (this.l.contains(localInteger));
    synchronized (this.l)
    {
      this.l.remove(new Integer(paramInt));
      if ((e()) && (!this.d))
      {
        c(1);
        this.d = true;
      }
      return;
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.ed
 * JD-Core Version:    0.6.0
 */